<div class="row" ng-controller="bs_book_oneUsedBook">

    <div class="col-md-9">

        <div class="row">
            <div class=col-md-6>
                <ol class="breadcrumb">
                    <li><a ui-sref="book.recommend()">图书主页</a></li>
                    <li><a ui-sref="book.used-book-list({cmd:'nearUsed'})">附近卖书</a></li>
                    <li><a ui-sref="book.one-book({isbn13:usedBook.attributes.isbn13})"
                           ng-bind="usedBook.attributes.bookInfo.attributes.title"></a></li>
                    <li class="active" ng-bind="title"></li>
                </ol>
            </div>
            <div class="col-md-6">
                <div class="btn-toolbar pull-right">
                    <div class="btn-group" ng-if="!isMy()">
                        <a class="btn btn-primary" ng-click="scrollToHash('大家都说')">大家都说</a>
                    </div>
                    <div class="btn-group">
                        <a class="btn btn-default" ng-click="scrollToHash('Ta的旧书')">Ta的旧书</a>
                        <a class="btn btn-default" ng-click="scrollToHash('Ta的求书')">Ta的求书</a>
                    </div>
                </div>
            </div>
        </div>

        <bs-one-book-info-detail book-info="usedBook.attributes.bookInfo"></bs-one-book-info-detail>

        <div class="row" id="大家都说">
            <div class="col-md-12">
                <h4>大家都说</h4>
                <hr>
                <a class="btn btn-link btn-info" ng-if="statusList.length==0"
                   ui-sref="person.send-msg-to-user({receiverObjectId:usedBook.attributes.owner.id,usedBookObjectId:usedBookObjectId,role:'buy',inboxType:'reviewUsedBook'})">还没有同学评论,快来抢沙发~</a>
            </div>
            <div class="col-md-12" ng-if="statusList.length>0">
                <ul class="media-list">
                    <li class="media" ng-repeat="status in statusList">
                        <bs-one-user class="media-left"
                                     user="status.attributes.source"
                                     popover-placement="right"
                                     margin="5"
                                     avatar-size="32"></bs-one-user>
                        <div class="media-body">
                            <em ng-bind="status.attributes.message"></em>
                            <a class="btn btn-link btn-sm"
                               ui-sref="common.user-home({ownerId:status.attributes.to.id})"
                               ng-bind="status.attributes.to.attributes.nickName"></a>
                            <small ng-bind="status.updatedAt | date:'mediumDate'"></small>
                        </div>
                    </li>
                </ul>
                <a ui-sref="person.send-msg-to-user({receiverObjectId:usedBook.attributes.owner.id,usedBookObjectId:usedBookObjectId,role:'buy',inboxType:'reviewUsedBook'})">我也要说</a>
            </div>
        </div>

        <div class="row" ng-if="ownerOtherCircleBooks.length>0">
            <div class="col-md-12">
                <h4>Ta的书漂流</h4>
                <hr>
            </div>
            <div class="col-md-3" ng-repeat="circleBook in ownerOtherCircleBooks">
                <bs-one-used-book used-book="circleBook"
                                  popover-placement="right"></bs-one-used-book>
            </div>
        </div>

        <div class="row" ng-if="ownerOtherUsedBooks.length>0">
            <div class="col-md-12">
                <h4 id="Ta的旧书">Ta的旧书</h4>
                <hr>
            </div>
            <div class="col-md-3" ng-repeat="usedBook in ownerOtherUsedBooks">
                <bs-one-used-book used-book="usedBook"
                                  popover-placement="right"></bs-one-used-book>
            </div>
        </div>

        <div class="row" ng-if="ownerOtherNeedBooks.length>0">
            <div class="col-md-12">
                <h4 id="Ta的求书">Ta的求书</h4>
                <hr>
            </div>
            <div class="col-md-3" ng-repeat="needBook in ownerOtherNeedBooks">
                <bs-one-used-book used-book="needBook"
                                  popover-placement="right"></bs-one-used-book>
            </div>
        </div>

    </div>

    <aside class="col-md-3">

        <div class="row">
            <div class="col-md-12">
                <h4 ng-bind="title"></h4>
                <hr>
            </div>
            <div class="col-md-12">
                <bs-one-user class="center-block"
                             user="usedBook.attributes.owner"
                             avatar-size="80"
                             popover-placement="right"
                             margin="5"
                             image-size="132"></bs-one-user>
                <hr>
                <p ng-if="usedBook.attributes.price>0">
                    <span ng-if="usedBook.attributes.role==='sell'">主人要价:</span>
                    <span ng-if="usedBook.attributes.role==='need'">最高承受价:</span>
                    <strong>{{usedBook.attributes.price}} 元</strong>
                </p>

                <p>
                    <span>上传时间:</span>
                    <span ng-bind="usedBook.updatedAt | date:'mediumDate'"></span>
                </p>

                <p ng-if="usedBook.attributes.des">
                    <span>主人描述:</span>
                    <span ng-bind="usedBook.attributes.des"></span>
                </p>
                <hr>
                <div ng-if="!isMy()">
                    <button style="margin: 5px" ng-if="usedBook.attributes.role ==='sell'"
                            class="btn btn-info" ng-click="Status$.requestSellUsedBook(usedBook,$event)">我买了,向Ta预定
                    </button>
                    <button style="margin: 5px" ng-if="usedBook.attributes.role ==='need'"
                            class="btn btn-info" ng-click="Status$.requestNeedUsedBook(usedBook,$event)">我正好有,卖给Ta
                    </button>
                    <button style="margin: 5px" ng-if="usedBook.attributes.role ==='circle'"
                            class="btn btn-info" ng-click="Status$.requestCircleUsedBook(usedBook,$event)">我想要,向Ta索要
                    </button>
                    <button style="margin: 5px" class="btn btn-primary"
                            ui-sref="person.send-msg-to-user({receiverObjectId:usedBook.attributes.owner.id,role:'buy',inboxType:'private',usedBookObjectId:usedBook.id})">
                        私信Ta
                    </button>
                </div>
                <div class="btn-group" ng-if="isMy()">
                    <button class="btn btn-info"
                            ng-if="usedBook.attributes.alive"
                            ng-click="UsedBook$.killUsedBook(usedBook)">
                        <span ng-if="usedBook.attributes.role==='sell'">已卖</span>
                        <span ng-if="usedBook.attributes.role==='need'">已买</span>
                        <span ng-if="usedBook.attributes.role==='circle'">已送</span>
                    </button>
                    <button class="btn btn-info"
                            ng-if="!usedBook.attributes.alive"
                            ng-click="UsedBook$.backToLifeUsedBook(usedBook)">
                        <span ng-if="usedBook.attributes.role==='sell'">撤销已卖</span>
                        <span ng-if="usedBook.attributes.role==='need'">撤销已买</span>
                        <span ng-if="usedBook.attributes.role==='circle'">撤销已送</span>
                    </button>
                    <button class="btn btn-warning" ui-sref="person.edit-one-used-book({usedBookId:usedBook.id})">
                        修改
                    </button>
                </div>
            </div>
        </div>

    </aside>
</div>
